<?php
/* SECURITY (don't touch) */
defined('_INCL')||(header('HTTP/1.1 403 Forbidden')&die('403.14 - Access denied.'));
/**************************/

?>

<div id='QRexisting' class='FakeForm'>
<style scoped>

	#QRexisting ol>li>ul { display:none; }

	#QRexisting { margin-top:1em; }

	#QRexisting .Color0 { color:#830 !important; background-color:rgba(255,255,128,0.2); }
	#QRexisting .Color1 { color:#177 !important; background-color:rgba(128,255,255,0.2); }
	#QRexisting .ColorRev0 { color:rgba(255,255,255,0.8) !important; background-color:#830; }
	#QRexisting .ColorRev1 { color:rgba(255,255,255,0.8) !important; background-color:#177; }

	#QRexisting ol>li { font-size:14px; line-height:1em; padding:0.2em 0.8em 0.2em 0.8em; }
	#QRexisting ol>li>span.Toggler { display:block; margin:0;padding:0.5em 0; }
	#QRexisting .Count { float:right; }

	#QRexisting ol>li>ul { margin:0;padding:0; }
	#QRexisting ol>li>ul>li {
		position:relative;
		background-color:rgba(0,0,0,0.1); margin:0.2em 0 0.8em 0;padding:0;
		border-bottom-left-radius:2px; border-bottom-right-radius:2px;
	}

	#QRexisting ol>li>ul>li span.Area { display:block; padding:0.8em 0.7em 0 1em; }

	#QRexisting .Button { float:right; clear:both; margin:-1px 0px 6px 0; }
	#QRexisting .Button.Hent {  }
	#QRexisting .Button.Slet { background-color:rgba(180,0,0,1.0); color:#FFF !important; }

	#QRexisting label.QRshowroom {
		font-size:9px;line-height:1em;
		margin:1.5em 0 0 0;
		text-align:center;
		-webkit-touch-callout:none; -webkit-user-select:none; -khtml-user-select:none; -moz-user-select:none; -ms-user-select:none;
		user-select:none;
	}
	#QRexisting label.QRshowroom>span {
		position:relative; z-index:1;
		letter-spacing:1px;
		padding:0.2em 0.8em;
	}
	#QRexisting .QRshowroom>div {
		margin-top:-0.4em;
		border-top:1px solid rgba(0,0,0,0.6);
		overflow-x:scroll; overflow-y:hidden; background-color:rgba(0,0,0, 0.2);
	}
	#QRexisting .QRshowroom>div>pre {
		padding:11px 11px 10px 10px; white-space:nowrap;
	}
	#QRexisting .QRshowroom>div>pre img { width:76px; height:60px; margin:0 8px 0 0; }


</style>

	<h1>Eksisterende produktions-serier</h1>

	<?
		$Word[0] = ($ProdSeries['Existing']['Info']['Series'] === 1) ? '1 serie' : $ProdSeries['Existing']['Info']['Series'].' serier';
		$Word[1] = ($ProdSeries['Existing']['Info']['Units'] === 1) ? '1 kørsel' : $ProdSeries['Existing']['Info']['Units'].' kørsler';
		$Word[2] = ($ProdSeries['Existing']['Info']['Total'] === 1) ? '1 enhed' : $ProdSeries['Existing']['Info']['Total'].' enheder';
		echo "<h5>$Word[0], produceret i $Word[1], indeholdende ialt $Word[2].</h5>";

		echo '<hr/>';

		echo '<ol>';
		$i = 0;
		$TempExisting = $ProdSeries['Existing']; unset($TempExisting['Info']);
		foreach($TempExisting as $Alphas => $Unit){
			$Word[0] = ($Unit['Info']['Units'] === 1) ? '1 kørsel' : $Unit['Info']['Units'].' kørsler';
			$Word[1] = ($Unit['Info']['Total'] === 1) ? '1 enhed' : $Unit['Info']['Total'].' enheder';
			$i = ($i+1)%2;
			echo "\t<li class='Round2 ShadowOut Color$i'><span class='Toggler'>Serie <b>$Alphas</b> (".$Unit['Info']['Min']."-".$Unit['Info']['Max'].")<span class='Count'>$Word[0], $Word[1]</span></span>".PHP_EOL;
			echo "\t\t\t<ul class='NoMark'>".PHP_EOL;

			$n1=$Unit['Info']['Units'];
			foreach($Unit as $ZipFile => $Data){
				if($ZipFile !== 'Info'){
					echo "\t\t\t\t<li class='Round3 ShadowIn'>";

					echo "<span class='Area'>"; $Dato = explode('|',$ZipFile);
					echo "<a class='Button Hent Color$i' href='../$WorkDirName$ZipFile' title='$ZipFile'>Hent $Data[Kb]kb ($Data[Total] enheder)</a>";
					$n1--; if( $n1 === 0 ){
						echo "<a class='Button Slet' href='$ZipFile' title='Slet denne kørsel...'>Slet ($Data[Total] enheder)</a>";
					}
					echo "<b>$Alphas ".ZeroPad($Data['Min'],6).'-'.ZeroPad($Data['Max'],6).'</b><br/>';
					echo "$Dato[1]<br/>";
					echo "Checksum: $Data[Checksum]";
					echo "</span>";

					echo "<label class='QRshowroom'><span class='Round4 ColorRev$i'>10 FØRSTE FRA DENNE KØRSEL</span>";
					echo "<div class='ShadowIn'><pre>";
					foreach( $Data['Examples'] as $File ){
						echo "<img src='../$Data[Dir]$File' alt='Kode'/>";
					}
					echo "</pre></div></label></li>".PHP_EOL;
					flush();
				}
			}
			echo "\t\t\t</ul>".PHP_EOL;
			echo "\t\t</li>".PHP_EOL;
		}
		echo "\t</ol>";
	?>
	<script>
		$('#QRexisting ol>li>span.Toggler').click(function(){
			$(this).siblings('ul').toggle();
		});


		$('div#QRexisting ul li a.Slet').click(function(e){
			e.preventDefault();
			$('div#Wait').toggle();
			File = $(this).attr('href');
			Identity = 'Din IP <? echo end($_SESSION['Client']['IP']); ?> registreres.';

			setTimeout(function(){
				Input = prompt("At slette medlemskort i systemet, er en delikat beslutning.\n"+Identity+"\n\nHvis den kørsel du er ved at slette, allerede er produceret i virkeligheden, bliver disse fysiske medlemskort altså helt ubrugelige!\n\nSåfremt du ved hvad du laver, skal du skrive “Jeg ved hvad jeg laver”, ellers bør du annullere.\n",'');

				if( Input ){
					Content = new Array();
					Content[0] = 'Action=Delete';
					Content[1] = 'File=' + File;
					Content[2] = 'Input=' + Input;
					location.replace('QRcreate.main.php?'+Obfuscate(Content));
				} else {
					$('div#Wait').toggle();
				}
			},250);
		});

	</script>
</div>
